<?php
/*
htmlspecialchars(
string $string,
int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401,
?string $encoding = null,
bool $double_encode = true
): string
 */
// /htmlspecialchars — 将特殊字符转换为 HTML 实体

$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new;
// &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;
